// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import {router} from './router'
import 'element-ui/lib/theme-chalk/index.css';

import * as filters from '@/api/filters';
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})

//全局的路由钩子函数。所有的路由，进入之前都会执行该方法！
router.beforeEach((to, from, next) => {
  //遍历meta改变title
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  next();
});


Vue.config.productionTip = false;

// 引入静态资源
require('@/assets/css/reset.scss');

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
